using System.Diagnostics.CodeAnalysis;
using System.Windows.Input;
using Bookvar.ObjectModel.Actions;

namespace Bookvar.UI.Commands
{
    public abstract class ActionCommand : CommandModel
    {
        protected ActionCommand( ICommand command ) : base( command )
        {
        }

        protected internal override void OnExecute( object sender, ExecutedRoutedEventArgs e )
        {
            IAction action = GetAction();
            action.Execute();
        }

        [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
        protected abstract IAction GetAction();
    }
}